package com.wontube.smr.model.vo.youtube;


public class YouTubeVideoFile {
	private String videoUrl;
	private long videoSize;
	private byte formatCode;

	public YouTubeVideoFile(String videoUrl, byte formatCode) {
		this.videoUrl = videoUrl;
		this.formatCode = formatCode;
	}

	public byte getFormatCode() {
		return this.formatCode;
	}

	public void setFormatCode(byte value) {
		this.formatCode = value;
	}

	public String getVideoUrl() {
		return this.videoUrl;
	}

	public void setVideoUrl(String videoUrl) {
		this.videoUrl = videoUrl;
	}

	public long getVideoSize() {
		return this.videoSize;
	}

	public void setVideoSize(long videoSize) {
		this.videoSize = videoSize;
	}

	public YouTubeVideoType getVideoFormat() {
		switch (this.formatCode) {
		case 34:
		case 35:
		case 5:
		case 6:
			return YouTubeVideoType.Flash;

		case 18:
		case 22:
		case 37:
		case 38:
		case 82:
		case 84:
			return YouTubeVideoType.MP4;

		case 13:
		case 17:
			return YouTubeVideoType.Mobile;

		case 43:
		case 45:
		case 46:
			return YouTubeVideoType.WebM;

		default:
			return YouTubeVideoType.Unknown;
		}
	}

	public String getVideoQuality() {
		switch (this.formatCode) {
		case 43:
			return "WebM Low Quality (360p)";

		case 44:
			return "WebM Standard Quality (480p)";

		case 45:
			return "WebM High Quality (720p)";

		case 46:
			return "WebM High Definition (1080p)";

		case 38:
			return "MP4 High Quality (4096p)";

		case 37:
			return "MP4 High Definition (1080p)";

		case 22:
			return "MP4 High Quality (720p)";

		case 82:
			return "MP4 3D Standard Quality (360p)";

		case 84:
			return "MP4 3D High Quality (720p)";

		case 35:
			return "FLV High Definition (480p)";

		case 34:
			return "FLV Standard Quality (360p)";

		case 18:
			return "MP4 Standard Quality (360p)";

		case 6:
			return "FLV Low Quality (270p)";

		case 5:
			return "FLV Low Quality (240p)";

		case 13:
		case 17:
			return "MP4 Mobile Video";

		default:
			return "";
		}
	}

	public String getFileExt() {
		switch (this.formatCode) {
		case 43:
		case 44:
		case 45:
		case 46:
			return ".webm";

		case 38:
		case 37:
		case 22:
		case 82:
		case 84:
		case 18:
			return ".mp4";

		case 35:
		case 34:
		case 6:
		case 5:
			return ".flv";

		case 13:
		case 17:
			return ".3pg";

		default:
			return "";
		}
	}
}